from pip._vendor import requests
import requests
import json


def weatherinfo(key, city, extensions=None, output="JSON") -> str:
    """天气查询"""
    url = "https://restapi.amap.com/v3/weather/weatherInfo?parameters"
    params = {
        "key": key,
        "city": city,
        "output": "json"
    }
    response = requests.get(url, params=params)
    results_weather = response.json()['lives'][0]["weather"]
    results_temperature = response.json()['lives'][0]["temperature"]
    results_winddirection = response.json()['lives'][0]['winddirection']
    # 返回值
    return results_weather,results_temperature,results_winddirection
